(ns code)

(defn n-max
  ([s]
    (n-max s  (int (/ (count s) 2))))
  ([s l]
    (let [ s (vec s)
          r (int (rand (- (* l 2) 1)))
          ge (filter #(> % ( s r)) s)
          le (filter #(<= % ( s r)) s)
          h l]
    (do  ;(println (str h "--" (seq ge) "--" (seq le)))
      (if (every? #(= (first s) %) ge)
        (take-nth h (vec ge) )
        (
      (cond (= h (count ge)) ge
        (> h (count ge)) (concat ge (n-max le (- h (count ge))))
        :else (n-max ge h))))
      ))))




